<?php
$alphabet = array('#','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z');
?><form action="<?=$_SERVER['PHP_SELF']?>" method="post">
<?php
foreach ($alphabet as $alpha) {
	echo ('<a href="' . $_SERVER['PHP_SELF'] . '?mode=cdlist&artistbeginwith=' . $alpha . '">' . strtoupper($alpha) . '</a> ');
//	echo ('<submit type="button" name="artistbeginwith" value="' . strtoupper($alpha) . '" /> ');
}
?>
</form><br /><?php
if (!ctype_alpha($_GET['artistbeginwith'])) {
	
} else {
	$sql = "
	   SELECT * FROM `album` 
	   WHERE 
	      (TRIM(LEADING 'the ' FROM LOWER(`artist`)) LIKE '".$_GET['artistbeginwith']."%') 
	      AND (`status`='2') 
	      ORDER BY TRIM(LEADING 'the ' FROM LOWER(`artist`)) ASC ";
	$sql_query = mysql_query($sql);
	while ($result = mysql_fetch_array($sql_query)) {
		print('<a href="?mode=cdview&cat=' . $cat . '&cddbid=' . $result[cddbid]. '">' . $result[artist] . '</a><br /> ');
	}
}
?>
<br />
<h3>old cds</h3>
<?php
$sql = "SELECT * FROM `album` WHERE (TRIM(LEADING 'the ' FROM LOWER(`artist`)) LIKE '".$_GET['artistbeginwith']."%') AND (`status`='3') ORDER BY TRIM(LEADING 'the ' FROM LOWER(`artist`)) ASC ";
$sql_query = mysql_query($sql);
while ($result = mysql_fetch_array($sql_query)) {
	print('<a href="?mode=cdview&cat=' . $cat . '&cddbid=' . $result[cddbid]. '">' . $result[artist] . '</a><br /> ');
}
?>